home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 43 / Amiga Format CD43 (1999)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1999-09].iso / -serious- / programming / other / gtdrag / include / libraries / gtdrag.i < prev   
Text File  |  1999-06-14  |  10KB  |  298 lines

  1.         IFND LIBRARIES_GTDRAG_I
  2. LIBRARIES_GTDRAG_I    SET     1
  3. **
  4. **  $VER: gtdrag.i 3.8 (10.6.99)
  5. **  Includes Release 3.2
  6. **
  7. **  Drag&Drop with GadTools
  8. **
  9. **  Copyright ©1999 pinc Software.
  10. **  All rights Reserved.
  11. **
  12.  
  13. *------------------------------------------------------------------------*
  14.  
  15.         IFND EXEC_LISTS_I
  16.         INCLUDE 'exec/lists.i'
  17.         ENDC
  18.  
  19.         IFND UTILITY_HOOKS_I
  20.         INCLUDE 'utility/hooks.i'
  21.         ENDC
  22.  
  23. *------------------------------------------------------------------------*
  24.  
  25. ********************** ObjectDescription structure **********************
  26.  
  27. * the ObjectDescription structure describes the contents of the object
  28. * being dragged.
  29.  
  30.     STRUCTURE ObjectDescription,0
  31.  
  32.       APTR   od_Object            * the pointer to the object
  33.       ULONG  od_GroupID           * DataTypes-GroupID (see datatypes.h)
  34.       ULONG  od_Type              * rough format of the object
  35.       ULONG  od_InternalType      * application related type
  36.       APTR   od_Owner             * owner name or NULL if you are the owner (STRPTR)
  37.       APTR   od_UserData
  38.  
  39.       LABEL  od_SIZE
  40.  
  41.  
  42. * Values for od_Type
  43.  
  44. ODT_UNKNOWN   EQU 0    * should only be used rarely
  45. ODT_STRING    EQU 1    * simple c-string (STRPTR)
  46. ODT_NODE      EQU 2    * (struct Node *)
  47. ODT_IMAGENODE EQU 4    * (struct ImageNode *)
  48. ODT_TREENODE  EQU 8    * (struct TreeNode *)
  49. ODT_IMAGE     EQU 16   * (struct Image *)
  50. ODT_ICON      EQU 32   * (struct DiskObject *)
  51. ODT_IFF       EQU 64   * pointer to an IFF-data stream
  52. ODT_LOCK      EQU 128  * a file lock
  53. ODT_DATATYPE  EQU 256  * a datatype object
  54. ODT_BITMAP    EQU 512  * (struct BitMap *)
  55.  
  56.  
  57. ********************** DropMessage structure **********************
  58.  
  59. * You receive the DropMessage structure if someone has dropped an object
  60. * on a gadget or in a window of your application. The IAddress field of
  61. * the IntuiMessage points to this structure.
  62. * Remember: all fields are read-only!
  63.  
  64.     STRUCTURE DropMessage,0
  65.  
  66.       STRUCT dm_Node,MLN_SIZE
  67.       STRUCT dm_Object,od_SIZE   * dragged object
  68.       APTR   dm_Gadget           * source gadget
  69.       APTR   dm_Window           * source gadget's window
  70.       APTR   dm_Target;          * pointer to the target gadget
  71.       LONG   dm_SourceEntry      * the list position of the entry
  72.       LONG   dm_TargetEntry      * dto. - may be higher than the number of entries
  73.       ULONG  dm_Flags
  74.  
  75.       LABEL  dm_SIZE
  76.  
  77. * Values for dm_Flags
  78.  
  79. DMF_DROPOVER  EQU 1              * for treeviews
  80.  
  81.  
  82. *** The flags for the IDCMP-MsgPort of your Window ***
  83.  
  84. DRAGIDCMP        EQU  LISTVIEWIDCMP!IDCMP_MOUSEBUTTONS
  85. IDCMP_OBJECTDROP EQU  IDCMP_DISKINSERTED!IDCMP_DISKREMOVED
  86.  
  87. * If you get a message of the IDCMP_OBJECTDROP class, someone dropped
  88. * an object on a gadget or in a window that supports it.
  89. * The IAddress-field of the IntuiMessage points to the DragMsg in this
  90. * case.
  91.  
  92.  
  93. *** Tags to pass to GTD_AddGadget() (a few also for GTD_AddWindow()) ***
  94.  
  95. GTDA_TagBase    EQU  TAG_USER+0x90000
  96.  
  97. ** describe the object
  98.  
  99. GTDA_Object            EQU  GTDA_TagBase+1    * drag node from a non-listview
  100. GTDA_GroupID           EQU  GTDA_TagBase+2    * Datatypes GroupID (see datatypes/datatypes.h)
  101. GTDA_Type              EQU  GTDA_TagBase+3    * rough format of object
  102. GTDA_InternalType      EQU  GTDA_TagBase+4    * internal type flag
  103. GTDA_Mask              EQU  GTDA_InternalType * for compatibility
  104. GTDA_Image             EQU  GTDA_TagBase+5    * image for dragging
  105. GTDA_RenderHook        EQU  GTDA_TagBase+6    * render hook for listview/object
  106. GTDA_ObjectDescription EQU  GTDA_TagBase+7    * pointer to struct ObjectDescription (contents will be copied)
  107.  
  108. ** general use
  109.  
  110. GTDA_Width         EQU  GTDA_TagBase+8     * width of icon (only for GTDA_RenderHook & GTDA_Images)
  111. GTDA_Height        EQU  GTDA_TagBase+9     * height of a icon ("")
  112. GTDA_NoDrag        EQU  GTDA_TagBase+10    * do not drag from this gadget
  113. GTDA_AcceptTypes   EQU  GTDA_TagBase+11    * accept mask value for internal drag&drop
  114. GTDA_AcceptMask    EQU  GTDA_AcceptTypes   * for compatibility
  115. GTDA_AcceptFunc    EQU  GTDA_TagBase+12    * function which checks for acceptance of the drag
  116. GTDA_ObjectFunc    EQU  GTDA_TagBase+13    * callback function before a drag starts
  117. GTDA_SourceEntry   EQU  GTDA_TagBase+21    * specifies the dm_SourceEntry field
  118.  
  119. ** listview specials
  120.  
  121. GTDA_ItemHeight    EQU  GTDA_TagBase+14    * height of a listview entry
  122. GTDA_NoPosition    EQU  GTDA_TagBase+15    * no position highlighting and scrolling
  123. GTDA_Same          EQU  GTDA_TagBase+16    * can move items inside its own list
  124. GTDA_Images        EQU  GTDA_TagBase+17    * drags only images (listview MUST contain ImageNodes/TreeNodes)
  125. GTDA_NoScrolling   EQU  GTDA_TagBase+18    * disables scrolling
  126. GTDA_DropOverItems EQU  GTDA_TagBase+19    * objects are dropped over other items
  127. GTDA_TreeView      EQU  GTDA_TagBase+20    * activate treeview specials
  128. GTDA_DropBetweenItems EQU GTDA_TagBase+22  * works only in conjungtion with GTDA_DropOverItems
  129.  
  130.  
  131. *** Tags to pass to GTD_AddApp() ***
  132.  
  133. GTDA_InternalOnly  EQU  GTDA_TagBase+42    * only internal drag&drop
  134. GTDA_NewStyle      EQU  GTDA_TagBase+43    * v3 is supported
  135.  
  136.  
  137. *** Constants for passing to GTD_GetHook() ***
  138.  
  139. GTDH_IMAGE      EQU  1
  140. GTDH_TREE       EQU  2
  141. GTDH_IFFSTREAM  EQU  3
  142.  
  143. *** data for GTDH_IFFSTREAM, set Hook's h_data to this structure ***
  144.  
  145.     STRUCTURE IFFStreamHookData,0
  146.  
  147.       APTR   is_Pool           * a memory pool, buffer will be AllocMem()ed if NULL
  148.       APTR   is_Buffer         * pointer to the buffer
  149.       ULONG  is_Size;          * size of the buffer
  150.       ULONG  is_Position;      * current stream position
  151.  
  152.       LABEL  ifshd_SIZE
  153.  
  154.  
  155. ********************** BOOPSI gadgets **********************
  156.  
  157. BOOPSI_KIND    EQU  1000                   * GTD_AddGadget() - Type
  158.  
  159. GM_OBJECTDRAG  EQU  GTDA_TagBase+1000      * see structures below
  160. GM_OBJECTDROP  EQU  GTDA_TagBase+1001
  161. GM_RENDERDRAG  EQU  GTDA_TagBase+1002
  162.  
  163.  
  164.     STRUCTURE gpObjectDrag,0
  165.  
  166.       ULONG  MethodID
  167.       APTR   gpod_Object       * pointer to an ObjectDescription
  168.       APTR   gpod_Source       * pointer to the source gadget
  169.       WORD   gpod_X
  170.       WORD   gpod_Y            * mouse coordinates
  171.  
  172.       LABEL  gpodrag_SIZE
  173.  
  174. * if GM_OBJECTDRAG is invoked you should return one of these values
  175. * to report gtdrag that you could make use of it (to speed up things)
  176.  
  177. GMR_REJECTOBJECT  EQU  1
  178. GMR_ACCEPTOBJECT  EQU  2
  179. GMR_UPDATE        EQU  4       * please update me (GM_RENDERDRAG will be invoked)
  180. GMR_FINAL         EQU  8       * store the result and do not ask again
  181.  
  182.  
  183.     STRUCTURE gpObjectDrop,0
  184.  
  185.       ULONG  MethodID
  186.       APTR   gpod_Message      * pointer to a DropMessage
  187.       ULONG  gpod_Qualifier
  188.  
  189.       LABEL  gpodrop_SIZE
  190.  
  191.  
  192.     STRUCTURE gpRenderDrag,0
  193.  
  194.       ULONG  MethodID
  195.       APTR   gprd_GInfo        * gadget context
  196.       APTR   gprd_RPort        * already for use
  197.       ULONG  gprd_Mode         * one of the GRENDER_xxx
  198.       WORD   gprd_MouseX
  199.       WORD   gprd_MouseY       * mouse coordinates
  200.  
  201.       LABEL  gprd_SIZE
  202.  
  203. GRENDER_HIGHLIGHT    EQU 0     * highlight yourself
  204. GRENDER_DELETE       EQU 1     * delete all highlights
  205. GRENDER_INTERIM      EQU 2     * refreshing between two GRENDER_HIGHLIGHT
  206.  
  207. * You have to return TRUE if you processed the rendering yourself,
  208. * otherwise gtdrag renders the standard highlighting.
  209. * Returning FALSE will also let gtdrag stop sending you GM_OBJECTDRAG
  210. * messages for the current drag.
  211.  
  212.  
  213.  
  214.                      ***************************
  215. ********************** additional structures ***********************
  216. **                  **************************                    **
  217. **                                                                **
  218. ** The additional structures provide special rendering options in **
  219. ** listviews which are supported by gtdrag. The CallBack-Hooks    **
  220. ** necessary to display these are reachable via the API.          **
  221. ** See GTD_GetHook().                                             **
  222. **                                                                **
  223. ********************************************************************
  224.  
  225.  
  226. ********************** ImageNode **********************
  227.  
  228. * The ImageNode structure is used to have both text and images in a listview.
  229. * A render hook for this type is provided. It is not a must!
  230.  
  231.  
  232.     STRUCTURE ImageNode,0
  233.  
  234.       APTR  in_Succ        * same as ListNode
  235.       APTR  in_Pred
  236.       UBYTE in_Type
  237.       BYTE  in_Pri
  238.       APTR  in_Name
  239.       APTR  in_Image       * plus pointer to an Image
  240.  
  241.       LABEL in_SIZE
  242.  
  243.  
  244. ********************** Tree Structures **********************
  245.  
  246. * The TreeNode structure provides the possibility of displaying trees
  247. * and images within a listview. A special tree hook is included.
  248.  
  249.  
  250.     STRUCTURE TreeList,0
  251.  
  252.       STRUCT tl_View,MLH_SIZE
  253.       STRUCT tl_Tree,MLH_SIZE
  254.  
  255.       LABEL tl_SIZE
  256.  
  257.  
  258.     STRUCTURE TreeNode,0
  259.  
  260.       STRUCT tn_Node,in_SIZE
  261.       STRUCT tn_ViewNode,MLN_SIZE
  262.       STRUCT tn_Nodes,MLH_SIZE
  263.       ULONG  tn_DepthLines
  264.       UBYTE  tn_Depth
  265.       UWORD  tn_Flags
  266.       WORD   tn_X
  267.       WORD   tn_Y
  268.       APTR   tn_Special
  269.  
  270.       LABEL  tn_SIZE
  271.  
  272.  
  273. TNF_NONE        EQU 0
  274. TNF_CONTAINER   EQU 1
  275. TNF_OPEN        EQU 2
  276. TNF_ADD         EQU 4
  277. TNF_REPLACE     EQU 8
  278. TNF_LAST        EQU 16     * last node in group
  279. TNF_STATIC      EQU 32     * can't move node
  280. TNF_NOSUBDIRS   EQU 64     * can't create sub-directory (this flag is for you only)
  281. TNF_SORT        EQU 256    * sort by name
  282. TNF_HIGHLIGHTED EQU 512    * highlight name
  283.  
  284.  
  285. ****** the following macros are C macros ******
  286.  
  287. ** from the ViewNode to the TreeNode **
  288. * #define TREENODE(ln) ((struct TreeNode *)((UBYTE *)ln - sizeof(struct ImageNode)))
  289.  
  290. ** size of the knobs **
  291. TREEKNOBSIZE  EQU  6
  292.  
  293. ** is the mouse pointer over the tree-knob? **
  294. * #define MouseOverTreeKnob(tn,h,msg) ((tn)->tn_X != -1 && (msg)->MouseX >= (tn)->tn_X && (msg)->MouseY >= (tn)->tn_Y+h && (msg)->MouseX <= (tn)->tn_X+TREEKNOBSIZE && (msg)->MouseY <= (tn)->tn_Y+TREEKNOBSIZE+h)
  295.  
  296.  
  297. ENDC  * LIBRARIES_GTDRAG_I
  298.